home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5421 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news2.ios.com!usenet
  2. From: vlad@gramercy.ios.com (Vlastimil Adamovsky)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: C++ Gurus! Is it correct?
  5. Date: Sun, 04 Feb 1996 16:02:26 GMT
  6. Organization: Internet Online Services
  7. Message-ID: <4f2koo$q5a@news2.ios.com>
  8. References: <4eqvtg$cg5@israel-info.datasrv.co.il> <4etnju$6gn@rolaids.frco.com> <4f0n8s$a3b@news2.ios.com> <311403bf.169980736@nntp.ix.netcom.com>
  9. NNTP-Posting-Host: ppp-35.ts-7.hck.idt.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. miker3@ix.netcom.com (Mike Rubenstein) wrote:
  13.  
  14. >vlad@gramercy.ios.com (Vlastimil Adamovsky) wrote:
  15. >> I don't think the virtual destructor is necessary in this specific
  16. >> case where you have no added data in subclasses. 
  17.  
  18. >Why do you think having data has anything to do with it?  From draft
  19. >5.3.5:
  20.  
  21. >    In the first alternative (delete object), if the static type
  22. >    of the operand is different from its dynamic type, the static
  23. >    type shall be a base  class of the operand's dynamic type
  24. >    and the static type shall have a virtual destructor or the
  25. >    behavior is undefined.
  26.  
  27.  
  28. I prefer slightly more simple explanation as follows:
  29.   (The Design and Evolution of C++, chapter 10.5 page 216)
  30.    ....
  31.     Had a virtual destructor not been used, the cleanup specified in
  32. Y's (in our case class B) destructor would not have been performed.
  33.  
  34.  
  35. Here you see you have choice to use virtual destructor or not. 
  36.  
  37. *******************************************
  38. *    Vlastimil Adamovsky                  *
  39. * Smalltalk, C++ and Envelop development  *
  40. *******************************************
  41.  
  42.